#ifndef PARTICLEDRAWER_H
#define PARTICLEDRAWER_H

#include <QOpenGLTexture>
#include "particle_shader_program.h"
#include "particle_system.h"
#include "vertex_drawer.h"

class ParticleDrawer : public VertexDrawer {
    public:
        ParticleDrawer(ParticleShaderProgram *program
                       , ParticleSystem *particleSysteml);
        virtual ~ParticleDrawer() {
            delete m_texture;
        };

    public:
        void draw() override;
        void setMatrix(const QMatrix4x4 &matrix);
        void setCurrentTime(float currentTime);

    private:
        ParticleSystem *m_particleSystem = nullptr;
        QMatrix4x4 m_matrix;
        float m_currentTime;
        QOpenGLTexture *m_texture = nullptr;
};

inline void ParticleDrawer::setMatrix(const QMatrix4x4 &matrix) {
    m_matrix = matrix;
}

inline void ParticleDrawer::setCurrentTime(float currentTime) {
    m_currentTime = currentTime;
};

#endif // PARTICLEDRAWER_H
